<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    table {
      width: 350px;
      margin: 100px auto;
      border: 1px solid #ccc;
      border-collapse: collapse;
    }
    tr,td,th {
      border: 1px solid #ccc;
      text-align: center;
    }
  </style>
</head>
<body>
  <table>
    <thead>
      <tr>
        <th>姓名</th>
        <th>性别</th>
        <th>分数</th>
        <th>操作</th>
      </tr>
    </thead>
    <tbody>
    </tbody>
  </table>

  <script>
    var list = [
      { uname: '张三', sex: '男', score: 99 },
      { uname: '丽丝', sex: '女', score: 80 },
      { uname: '王五', sex: '男', score: 100 },
      { uname: '铁山考', sex: '男', score: 100 },
      { uname: '小丽', sex: '女', score: 20 }
    ]

    var tbody = document.querySelector('tbody')

    for(var i = 0; i < list.length; i++) {
      var tr = document.createElement('tr')

      for(var key in list[i]) {
        var td = document.createElement('td')

        td.innerHTML = list[i][key]

        tr.appendChild(td)
      }
      var td = document.createElement('td')

      td.innerHTML = '<a href="javascript:;">删除</a>'

      tr.appendChild(td)

      tbody.appendChild(tr)
    }

    var aList = document.querySelectorAll('a')
    
    for(var i = 0; i < aList.length; i++) {
      aList[i].onclick = function() {
        tbody.removeChild(this.parentNode.parentNode)
      }
    }

  </script>
</body>
</html>